const domain = "https://www.tiantong369.com";
function post(link, req) {
  var url = domain + link;
  var promise = new Promise(function(resolve, reject) {
    wx.request({
      //地址
      url: url,
      //请求的参数
      data: req,
      //提交方式
      method: "POST",
      //头信息设置
      header: {
        'x-access-token': wx.getStorageSync("token")
      },
      //接口调用成功
      success: resolve,

      //接口调用失败
      fail: reject,

      //接口调用结束
      //wx.hideLoading() 隐藏 loading 提示框
      // complete: wx.hideLoading(),
    });
  });
  return promise;
}

/*
 * 对外暴露接口
 */
module.exports = {
  post: post,
}